package aop.xyz.myapp.account;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import aop.xyz.myapp.domain.account.User;

@Aspect
public class AfterAdvice {
	public static final Logger log = LoggerFactory.getLogger(AfterAdvice.class);
	public static String CMNTS = "Modified by @AfterReturning advice";
	
	@AfterReturning(pointcut = "aop.xyz.myapp.account.SystemArchitecture.delUserById()", 
			returning = "retVal")
	public void changeTheReturnVal(Object retVal) {
		if (retVal instanceof User) {
			User user = (User) retVal;
			user.setComments(CMNTS);
		}
		log.debug("@AfterReturning advice was executed.");
	}
}
